#include "MsgObserver.h"

using namespace kc_sf;

// ---------------------------------------------------------------- //

Observer::Observer()
: mo_nr( 0 )
{
}

// ---------------------------------------------------------------- //

unsigned long Observer::add()
{
	boost::mutex::scoped_lock lock( mo_guard );
	return ++ mo_nr;
}

// ---------------------------------------------------------------- //

unsigned long Observer::extract()
{
	boost::mutex::scoped_lock lock( mo_guard );
	return -- mo_nr;
}

// ---------------------------------------------------------------- //

unsigned long Observer::size ()
{
	boost::mutex::scoped_lock lock( mo_guard );
	return mo_nr;
}


